package quotation.web.wx.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import quotation.R.R;
import quotation.web.wx.service.WXService;


/**
 * @author lyx
 * @date 2023/7/14
 */
@RestController
@RequestMapping("/WXApi")
@Api(tags = "微信相关Api")
public class WxApiController {

    @Autowired
    private WXService wxService;

    @ApiOperation(value = "网页授权获取用户基本信息", notes = "网页授权获取用户基本信息")
    @GetMapping("/getOpenId")
    public R<String> getOpenId(@RequestParam String code) {

        String openId = wxService.getOpenId(code);

        return R.success("获取成功", openId);
    }

}
